package fhq.hcmute.modernshopping.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import fhq.hcmute.modernshopping.R;

/**
 * @author: Hien Nguyen Le
 * @emai: hien.nguyenle.it@gmail.com
 * 
 */
public class MainActivity extends Activity {

	private TextView btn_Shopping;
	private TextView btn_PurchaseHistory;
	private TextView btn_Setting;
	private TextView btn_ScanQRCode;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		init();
	}

	private void init() {
		btn_Shopping = (TextView) findViewById(R.id.btn_shopping);
		btn_Shopping.setOnClickListener(onBtnShoppingClick);
		btn_PurchaseHistory = (TextView) findViewById(R.id.btn_purchase_istory);
		btn_PurchaseHistory.setOnClickListener(onBtnPurchaseHistory);
		btn_Setting = (TextView) findViewById(R.id.btn_setting);
		btn_Setting.setOnClickListener(onBtnSettingClick);
		btn_ScanQRCode = (TextView) findViewById(R.id.btn_scan_qrcode);
		btn_ScanQRCode.setOnClickListener(onBtnScanQrCodeClick);
	}

	private OnClickListener onBtnShoppingClick = new OnClickListener() {

		@Override
		public void onClick(View v) {
			Intent intent = new Intent(getApplicationContext(),
					ShoppingActivity.class);
			startActivity(intent);
		}
	};

	private OnClickListener onBtnScanQrCodeClick = new OnClickListener() {

		@Override
		public void onClick(View v) {
			Intent intent = new Intent(getApplicationContext(),
					ScanQrCodeActivity.class);
			intent.putExtra(ScanQrCodeActivity.SCAN_QRCODE_KEY,
					R.layout.activity_main);
			startActivity(intent);
		}
	};

	private OnClickListener onBtnPurchaseHistory = new OnClickListener() {

		@Override
		public void onClick(View v) {
			Intent intent = new Intent(getApplicationContext(),
					PurchaseHistoryActivity.class);
			startActivity(intent);
		}
	};

	private OnClickListener onBtnSettingClick = new OnClickListener() {

		@Override
		public void onClick(View v) {
			Intent intent = new Intent(getApplicationContext(),
					SettingsActivity.class);
			startActivity(intent);
		}
	};
}
